const { npm_package_name: outputDir } = process.env;

module.exports = {
  publicPath: '/',
  outputDir,
  productionSourceMap: false,
  chainWebpack: (config) => {
    config.module
      .rule('yml')
      .test(/\.ya?ml$/)
      .use('json')
      .loader('json-loader')
      .end()
      .use('yaml')
      .loader('yaml-loader')
      .end();
    config.module
      .rule('i18n')
      .resourceQuery(/blockType=i18n/)
      .type('javascript/auto')
      .use('i18n')
      .loader('@kazupon/vue-i18n-loader')
      .end()
      .use('yaml')
      .loader('yaml-loader')
      .end();
  },
  lintOnSave: false,
  devServer: {
    // host: '127.0.0.1',
    proxy: {
      '/taobao': {
        target: 'http://api.m.taobao.com',
        changeOrigin: true,
        pathRewrite: {
          '^/taobao': '', // 需要rewrite重写的,
        },
      },
    },
  },
};

// 访问地址
// https://www.amateras.io
